package com.jz.community.moduleshoppingguide.home.presenter;

import com.jz.community.basecomm.mvp.BaseLifeCyclePresent;
import com.jz.community.basecomm.net.rxandroid.OnLoadListener;
import com.jz.community.moduleshoppingguide.home.bean.ChunnelNewbornBean;
import com.jz.community.moduleshoppingguide.home.model.ShoppingGuideModel;
import com.jz.community.moduleshoppingguide.home.model.ShoppingModelGuideImpl;
import com.jz.community.moduleshoppingguide.home.ui.NewbornView;

public class NewbornPresenter extends BaseLifeCyclePresent<NewbornView.View> implements NewbornView.Presenter {


    private ShoppingGuideModel shoppingModel;
    private NewbornView.View mView;

    public NewbornPresenter(NewbornView.View v) {
        mView = v;
        shoppingModel = new ShoppingModelGuideImpl(v.getContext());
    }

    @Override
    public void getChunnelNewborn(int page, int size, int type) {
        shoppingModel.getChunnelNewborn(page, size, new OnLoadListener<ChunnelNewbornBean>() {
            @Override
            public void onSuccess(ChunnelNewbornBean chunnelNewbornBean) {
                mView.showChunnelNewborn(chunnelNewbornBean, type);
            }

            @Override
            public void onFail(String s, int code) {
                mView.showError(s, type);
            }
        });
    }
}
